package com.zy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.entity.Department;
import com.zy.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 杨深俊
 * @Date: 2021/04/14/11:57
 * @Description:
 */
@Repository
@Mapper
public interface ZyDepartMapper extends BaseMapper<Department> {
    @Delete("delete from post_department_mapping where department_id = #{departmentId}")
    public void delDepartsById(Integer id);

    @Delete("delete from department where department_id = #{departmentId}")
    public void delDepartById(Integer id);

    @Update("update department set department_name = #{departmentName},manager_id = #{managerId} where department_id = #{departmentId}")
    public void updateDepart(Department department);

    @Select("select department_id,department_name,manager_id from department where department_id = #{departmentId}")
    public Department selectDepart(Integer id);

    @Select("select * from department")
    public List<Department> getDeparts();

    @Select("select * from user")
    public List<User> getUsers();

}
